Employees' spending details

This request is used to get detailed information about the employees' spendings committed within their limits. If no limit has been set for the employee at the time of the spending, information on this spending will not be included in the response.

Request syntax

POST https://b2b-api.go.yandex.ru/integration/2.0/users-spending-details

Request headers

  • Authorization: Bearer <OAuth-token>
    OAuth access token. The steps to get a token are described in Getting started.
  • X-YaTaxi-Selected-Corp-Client-Id — client ID from the account. Required if multiple clients are available using the token.

Request body

List of employees for whom spending details are requested is passed in the request body in JSON format:

Field

Description

Format

Required

user_ids

Array of employees' ids (no more than 100)

Array of strings

Yes

Response field description

Responses may contain the following fields:

Field

Description

Format

users

The list of employees.

Array

Structure of the users array element:

Field

Description

Format

limits

The limits on the amount an employee can spend on services in a calendar month.

An array of elements that contains a separate element for each service.

user_id

The client's ID (account).

String

Structure of the limits array element:

Field

Description

Format

limit_id

Limit ID

String

service

The name of the limit service. Acceptable values: taxi, eats2, drive, tanker, grocery.

String

spending_details

Employee spending data.

Object

Structure of the spending_details object:

Field

Description

Format

orders_cost

Spending limit restrictions.

String

spent

The amount spent by the employee under this limit for the current period.

String

orders_amount

A limit on the number of rides that the employee can make during the period. Specified only for the taxi service.

Integer

orders_spent

The number of orders the employee made during the current period.

Integer

Request examples

POST url https://b2b-api.go.yandex.ru/integration/2.0/users-spending-details 
...
Authorization: Bearer <OAuth-token>
X-YaTaxi-Selected-Corp-Client-Id: <client-id>

  { "user_ids": [
      "26e8...3f62", 
      "5758...0ede"
    ]
  }

Response example

An example response to this request looks like this:

{
  "users": [
    {
      "limits": [
        {
          "limit_id": "f81ea...9c6a2",
          "service": "drive",
          "spending_details": {
            "orders_cost": "10000",
            "spent": "0",
            "orders_spent": 0
          }
        },
        {
          "limit_id": "64f1...3fb8",
          "service": "eats2",
          "spending_details": {
            "orders_cost": "147614.40",
            "spent": "0",
            "orders_spent": 0
          }
        }
      ],
      "user_id": "26e8...3f62"
    },
    {
      "limits": [
        {
          "limit_id": "8062...d071",
          "service": "taxi",
          "spending_details": {
            "orders_cost": "10000",
            "spent": "3894",
            "orders_amount": 5,
            "orders_spent": 2
          }
        },
        {
          "limit_id": "794e...30c4",
          "service": "eats2",
          "spending_details": {
            "orders_cost": "3600",
            "spent": "0",
            "orders_spent": 0
          }
        },
        {
          "limit_id": "1cd7...33cc",
          "service": "drive",
          "spending_details": {
            "orders_cost": "12331",
            "spent": "10000",
            "orders_spent": 8
          }
        },
        {
          "limit_id": "7f5d...282c",
          "service": "tanker",
          "spending_details": {
            "orders_cost": "8765",
            "spent": "5478",
            "orders_spent": 3
          }
        }
      ],
      "user_id": "5758...0ede"
    }
  ]
}

Response codes

The response to this request may contain the following standard HTTP codes:

  • 200: Request completed successfully.
  • 400: An unknown parameter or a parameter with an invalid value was passed in the request.
  • 401: The OAuth token is incorrect.
  • 403: The client doesn't have sufficient rights to run this request.
    • SELECT_CLIENT_HEADER_REQUIRED: the request did not pass the header X-YaTaxi-Selected-Corp-Client-Id (returned if more than one client is available for the token).
    • SELECTED_CLIENT_ACCESS_DENIED: the header X-YaTaxi-Selected-Corp-Client-Id contains the client's ID, which this login does not have access to.